<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <title>财务部</title>
    <meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0, shrink-to-fit=no'
          name='viewport'/>
    <!-- <link rel="stylesheet" href="assets/css/bootstrap.min.css">
     <link rel="stylesheet"
           href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i">
     <link rel="stylesheet" href="assets/css/ready.css">
     <link rel="stylesheet" href="assets/css/demo.css">
     <link rel="stylesheet" href="angularjs/pagination.css">
     <script src="bootstrap/js/jquery.min.js"></script>
     <script src="../homePage/layer/layer.js"></script>
     <script src="angularjs/angular.min.js"></script>
     <script src="angularjs/pagination.js"></script>-->
    <link rel="stylesheet" href="assets/css/bootstrap.min.css">
    <link rel="stylesheet" href="assets/css/ready.css">
    <link rel="stylesheet" href="assets/css/demo.css">
    <link rel="stylesheet" href="bootstrap/css/bootstrap.css">
    <link rel="stylesheet" href="assets/layer/layer/theme/default/layer.css"/>
    <link rel="stylesheet" href="angularjs/pagination.css">
    <script src="../homePage/js/jquery-1.9.1/jquery.js"></script>
    <script src="bootstrap/js/bootstrap.js"></script>
    <script src="layer/layer.js"></script>
    <script src="angularjs/angular.min.js"></script>
    <script src="angularjs/pagination.js"></script>
</head>
<style type="text/css">
    .main-panel {
        background-color: #FFFFFF !important;
    }

    .content {
        background-color: #FFFFFF !important;
    }
</style>
<script>
    var app = angular.module("myApp", ['pagination']);
    app.controller("myCtrl", function ($scope, $http) {
        var admin = sessionStorage.getItem("admin");
        $scope.userid = JSON.parse(admin).userid;
        $scope.username = JSON.parse(admin).username;
        $scope.paginationConf = {
            currentPage: 1,
            itemsPerPage: 8,
            totalItems: 500,
            perPageOptions: [8, 10, 20, 50, 100],
            onChange: function () {
                $scope.searchByMoney($scope.paginationConf.currentPage, $scope.paginationConf.itemsPerPage);

            }
        }
        //初始化数据
        $scope.myinitPage = function () {
            $http.get("http://localhost:9001/pay/selectPage").success(function (data) {
                $scope.list = data.rows;
                $scope.paginationConf.totalItems = data.total;
            })
        }
        /*   //初始化分页
           $scope.search = function (pageIndex, pageSize) {
               $http.get("http://localhost:9001/pay/selectPage1/" + pageIndex + "/" + pageSize).success(function (data) {
                   $scope.list = data.rows;
                   $scope.paginationConf.totalItems = data.total;
               })
           }*/
        //查询金额分页
        $scope.searchByMoney = function (pageIndex, pageSize) {
            var reg = /^([1-9]\d*|[0]{1,1})$/;

            if (parseInt($scope.money1) > parseInt($scope.money2)) {
                layer.msg("输入有误,请重新输入")
            }
            else {
                if ($scope.money1 == "") {
                    $scope.money1 = 0;
                }
                if ($scope.money2 == "") {
                    $scope.money2 = 9999999999;
                }

                var money1 = $scope.money1;
                var money2 = $scope.money2;

                if (reg.test(money1) == false || reg.test(money2) == false) {
                    layer.msg("请输入0或正整数")
                } else {
                    $http.get("http://localhost:9001/pay/searchmoney/" + pageIndex + "/" + pageSize + "/" + $scope.money1 + "/" + $scope.money2).success(function (data) {
                        $scope.list = data.rows;
                        $scope.paginationConf.totalItems = data.total;
                        layer.msg("查询成功")
                    })
                }
            }
        }
        $scope.search1 = function () {
            $scope.searchByMoney($scope.paginationConf.currentPage, $scope.paginationConf.itemsPerPage)
        }
        //退出登陆
        $scope.quiet = function () {
            sessionStorage.clear();
            window.location.href = "../adminLogin/login.html";
        }
        //点击放款 修改理赔状态
        $scope.paymoney = function (money, reportid, policynum) {
            $http.get("http://localhost:9001/pay/paymoney/" + money + "/" + reportid + "/" + policynum).success(function (data) {
                if (data.code == 200) {
                    $scope.myinitPage();
                    layer.msg(data.msg, {icon: 6})
                } else if (data.code == 100) {
                    layer.msg(data.msg)
                } else {
                    layer.msg(data.msg)
                }
            })
        }
        //提醒用户绑定银行卡
        $scope.reminduser = function (policynum) {
            $http.get("http://localhost:9001/pay/reminduser/" + policynum).success(function (data) {
                if (data.code == 100) {
                    layer.msg(data.msg)
                } else if (data.code == 200) {
                    layer.msg(data.msg)
                } else {
                    layer.msg(data.msg)
                }
            })
        }
    });

</script>
<body ng-controller="myCtrl" ng-app="myApp" ng-init="myinitPage()">
<div class="wrapper">
    <div class="main-header">
        <div class="logo-header">
            <a href="pay.html" class="logo">
                <img src="img/logo.png" style="height: 40px;width: 100px"> 财务部
            </a>
            <button class="navbar-toggler sidenav-toggler ml-auto" type="button" data-toggle="collapse"
                    data-target="collapse"
                    aria-controls="sidebar" aria-expanded="false" aria-label="Toggle navigation">
                <span class="navbar-toggler-icon"></span>
            </button>
            <button class="topbar-toggler more"><i class="la la-ellipsis-v"></i></button>
        </div>
        <nav class="navbar navbar-header navbar-expand-lg float-right">
            <div class="container-fluid">
                <ul class="navbar-nav topbar-nav ml-md-auto align-items-center">
                    <li class="nav-item dropdown">
                        <a class="dropdown-toggle profile-pic" data-toggle="dropdown" href="#" aria-expanded="false">
                            <span ng-value="$scope.username">{{username}}</span></span>
                        </a>
                        <ul class="dropdown-menu dropdown-user">
                            <li>
                                <div class="user-box">
                                    <div class="u-text">
                                        <a ng-click="quiet()" class="btn btn-rounded btn-danger btn-sm">退出登录</a>
                                    </div>
                                </div>
                            </li>

                        </ul>
                        <!-- /.dropdown-user -->
                    </li>
                </ul>
            </div>
        </nav>
    </div>
    <div class="sidebar">
        <div class="scrollbar-inner sidebar-wrapper">
            <div class="user">

            </div>
            <ul class="nav">
                <li class="nav-item active">
                    <a href="pay.html">
                        <i class="la la-dashboard"></i>
                        <p>等候处理</p>
                        <!-- <span class="badge badge-count">5</span> -->
                    </a>
                </li>
                <li class="nav-item">
                    <a href="resulted.html">
                        <i class="la la-fonticons "></i>
                        <p>已处理</p>
                        <!-- <span class="badge badge-count">5</span> -->
                    </a>
                </li>

            </ul>
        </div>
    </div>
    <div class="main-panel">
        <div class="content">
            <div class=" card col-md-12">

                <div class="panel panel-info">

                    <div class="card card-header ">
                        <div class="form-inline">
                            <a class="btn btn-success" ng-click="search1()">查询</a>&nbsp;&nbsp;
                            <input class="form-control col-sm-1" ng-model="money1" ng-init="money1 = 0">&nbsp; 至 &nbsp;
                            <input class="form-control col-sm-1" ng-model="money2" ng-init="money2 = 9999999">&nbsp; 元
                        </div>
                    </div>
                    <div class="panel panel-body">


                        <table class="table table-hover table-bordered table-condensed table-striped text-center">
                            <tr>
                                <td>序号</td>
                                <td>报案号</td>
                                <td>保单号</td>
                                <td>最后修改时间</td>
                                <td>理赔单状态</td>
                                <td>勘查人员id</td>
                                <td>定损人员id</td>
                                <td>案件险</td>
                                <td>赔付金额</td>
                                <td>审核人员id</td>
                                <td>备注</td>
                                <td>操作</td>
                            </tr>
                            <tr ng-repeat="c in list">
                                <td ng-bind="$index+1"></td>
                                <td>{{c.reportid}}</td>
                                <td>{{c.policynum}}</td>
                                <td>{{c.lastmodifytime | date:'yyyy-MM-dd HH:mm:ss'}}</td>
                                <td>{{c.reportstate}}</td>
                                <td>{{c.surveyorid}}</td>
                                <td>{{c.secondid}}</td>
                                <td>{{c.payprogram}}</td>
                                <td>{{c.money}}</td>
                                <td>{{c.firstid}}</td>
                                <td>{{c.remark}}</td>
                                <td>
                                    <button ng-click="paymoney(c.money,c.reportid,c.policynum)" class="btn btn-info">放款
                                    </button>
                                    <button ng-click="reminduser(c.policynum)" class="btn btn-warning">提醒用户绑卡</button>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="12" class="text-center">
                                    <tm-pagination conf="paginationConf"
                                                   style="position: relative;left: 300px"></tm-pagination>
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

</body>
<script src="assets/js/core/jquery.3.2.1.min.js"></script>
<script src="assets/js/plugin/jquery-ui-1.12.1.custom/jquery-ui.min.js"></script>
<script src="assets/js/core/popper.min.js"></script>
<script src="assets/js/core/bootstrap.min.js"></script>
<script src="assets/js/plugin/chartist/chartist.min.js"></script>
<script src="assets/js/plugin/chartist/plugin/chartist-plugin-tooltip.min.js"></script>
<script src="assets/js/plugin/bootstrap-notify/bootstrap-notify.min.js"></script>
<script src="assets/js/plugin/bootstrap-toggle/bootstrap-toggle.min.js"></script>
<script src="assets/js/plugin/jquery-mapael/jquery.mapael.min.js"></script>
<script src="assets/js/plugin/jquery-mapael/maps/world_countries.min.js"></script>
<script src="assets/js/plugin/chart-circle/circles.min.js"></script>
<script src="assets/js/plugin/jquery-scrollbar/jquery.scrollbar.min.js"></script>
<script src="assets/js/ready.min.js"></script>
</html>